package com.example.rabbitmq.controller.qos;

import com.example.rabbitmq.Constants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/producer")
public class QosProducerController {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @RequestMapping("/qos")
    public String qos() {
        for (int i = 0; i < 20; i++) {
            String message = "qos test... " + i;
            rabbitTemplate.convertAndSend(Constants.QOS_EXCHANGE,"qos",message);
        }
        return "发送消息成功";
    }
}
